<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE Safe #-}</span><span>
</span><span id="line-2"></span><span>
</span><span id="line-3"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-4"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- Module      :  Data.STRef.Lazy</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- Copyright   :  (c) The University of Glasgow 2001</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- License     :  BSD-style (see the file libraries/base/LICENSE)</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- </span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Maintainer  :  libraries@haskell.org</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- Stability   :  experimental</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Portability :  non-portable (uses Control.Monad.ST.Lazy)</span><span>
</span><span id="line-12"></span><span class="hs-comment">--</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- Mutable references in the lazy ST monad.</span><span>
</span><span id="line-14"></span><span class="hs-comment">--</span><span>
</span><span id="line-15"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-16"></span><span>
</span><span id="line-17"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.STRef.Lazy</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-18"></span><span>        </span><span class="annot"><span class="hs-comment">-- * STRefs</span></span><span>
</span><span id="line-19"></span><span>        </span><span class="annot"><a href="GHC.STRef.html#STRef"><span class="hs-identifier">ST.STRef</span></a></span><span class="hs-special">,</span><span>       </span><span class="hs-comment">-- abstract</span><span>
</span><span id="line-20"></span><span>        </span><span class="annot"><a href="Data.STRef.Lazy.html#newSTRef"><span class="hs-identifier">newSTRef</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-21"></span><span>        </span><span class="annot"><a href="Data.STRef.Lazy.html#readSTRef"><span class="hs-identifier">readSTRef</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-22"></span><span>        </span><span class="annot"><a href="Data.STRef.Lazy.html#writeSTRef"><span class="hs-identifier">writeSTRef</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-23"></span><span>        </span><span class="annot"><a href="Data.STRef.Lazy.html#modifySTRef"><span class="hs-identifier">modifySTRef</span></a></span><span>
</span><span id="line-24"></span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-25"></span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Control.Monad.ST.Lazy.html"><span class="hs-identifier">Control.Monad.ST.Lazy</span></a></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.STRef.html"><span class="hs-identifier">Data.STRef</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">ST</span></span><span>
</span><span id="line-28"></span><span>
</span><span id="line-29"></span><span id="local-6989586621679566077"><span id="local-6989586621679566078"><span class="annot"><a href="Data.STRef.Lazy.html#newSTRef"><span class="hs-identifier hs-type">newSTRef</span></a></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679566078"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.ST.Lazy.Imp.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679566077"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.STRef.html#STRef"><span class="hs-identifier hs-type">ST.STRef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679566077"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679566078"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-30"></span><span id="local-6989586621679566063"><span id="local-6989586621679566064"><span class="annot"><a href="Data.STRef.Lazy.html#readSTRef"><span class="hs-identifier hs-type">readSTRef</span></a></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.STRef.html#STRef"><span class="hs-identifier hs-type">ST.STRef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679566064"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679566063"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.ST.Lazy.Imp.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679566064"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679566063"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-31"></span><span id="local-6989586621679566057"><span id="local-6989586621679566058"><span class="annot"><a href="Data.STRef.Lazy.html#writeSTRef"><span class="hs-identifier hs-type">writeSTRef</span></a></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.STRef.html#STRef"><span class="hs-identifier hs-type">ST.STRef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679566058"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679566057"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679566057"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.ST.Lazy.Imp.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679566058"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span></span><span>
</span><span id="line-32"></span><span id="local-6989586621679566051"><span id="local-6989586621679566052"><span class="annot"><a href="Data.STRef.Lazy.html#modifySTRef"><span class="hs-identifier hs-type">modifySTRef</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.STRef.html#STRef"><span class="hs-identifier hs-type">ST.STRef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679566052"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679566051"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679566051"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679566051"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.ST.Lazy.Imp.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679566052"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span></span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span id="newSTRef"><span class="annot"><span class="annottext">newSTRef :: forall a s. a -&gt; ST s (STRef s a)
</span><a href="Data.STRef.Lazy.html#newSTRef"><span class="hs-identifier hs-var hs-var">newSTRef</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ST s (STRef s a) -&gt; ST s (STRef s a)
forall s a. ST s a -&gt; ST s a
</span><a href="Control.Monad.ST.Lazy.Imp.html#strictToLazyST"><span class="hs-identifier hs-var">strictToLazyST</span></a></span><span> </span><span class="annot"><span class="annottext">(ST s (STRef s a) -&gt; ST s (STRef s a))
-&gt; (a -&gt; ST s (STRef s a)) -&gt; a -&gt; ST s (STRef s a)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; ST s (STRef s a)
forall a s. a -&gt; ST s (STRef s a)
</span><a href="GHC.STRef.html#newSTRef"><span class="hs-identifier hs-var">ST.newSTRef</span></a></span><span>
</span><span id="line-35"></span><span id="readSTRef"><span class="annot"><span class="annottext">readSTRef :: forall s a. STRef s a -&gt; ST s a
</span><a href="Data.STRef.Lazy.html#readSTRef"><span class="hs-identifier hs-var hs-var">readSTRef</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ST s a -&gt; ST s a
forall s a. ST s a -&gt; ST s a
</span><a href="Control.Monad.ST.Lazy.Imp.html#strictToLazyST"><span class="hs-identifier hs-var">strictToLazyST</span></a></span><span> </span><span class="annot"><span class="annottext">(ST s a -&gt; ST s a) -&gt; (STRef s a -&gt; ST s a) -&gt; STRef s a -&gt; ST s a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">STRef s a -&gt; ST s a
forall s a. STRef s a -&gt; ST s a
</span><a href="GHC.STRef.html#readSTRef"><span class="hs-identifier hs-var">ST.readSTRef</span></a></span><span>
</span><span id="line-36"></span><span id="writeSTRef"><span class="annot"><span class="annottext">writeSTRef :: forall s a. STRef s a -&gt; a -&gt; ST s ()
</span><a href="Data.STRef.Lazy.html#writeSTRef"><span class="hs-identifier hs-var hs-var">writeSTRef</span></a></span></span><span>  </span><span id="local-6989586621679566038"><span class="annot"><span class="annottext">STRef s a
</span><a href="#local-6989586621679566038"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679566037"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679566037"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ST s () -&gt; ST s ()
forall s a. ST s a -&gt; ST s a
</span><a href="Control.Monad.ST.Lazy.Imp.html#strictToLazyST"><span class="hs-identifier hs-var">strictToLazyST</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">STRef s a -&gt; a -&gt; ST s ()
forall s a. STRef s a -&gt; a -&gt; ST s ()
</span><a href="GHC.STRef.html#writeSTRef"><span class="hs-identifier hs-var">ST.writeSTRef</span></a></span><span> </span><span class="annot"><span class="annottext">STRef s a
</span><a href="#local-6989586621679566038"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679566037"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-37"></span><span id="modifySTRef"><span class="annot"><span class="annottext">modifySTRef :: forall s a. STRef s a -&gt; (a -&gt; a) -&gt; ST s ()
</span><a href="Data.STRef.Lazy.html#modifySTRef"><span class="hs-identifier hs-var hs-var">modifySTRef</span></a></span></span><span> </span><span id="local-6989586621679566035"><span class="annot"><span class="annottext">STRef s a
</span><a href="#local-6989586621679566035"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679566034"><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621679566034"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ST s () -&gt; ST s ()
forall s a. ST s a -&gt; ST s a
</span><a href="Control.Monad.ST.Lazy.Imp.html#strictToLazyST"><span class="hs-identifier hs-var">strictToLazyST</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">STRef s a -&gt; (a -&gt; a) -&gt; ST s ()
forall s a. STRef s a -&gt; (a -&gt; a) -&gt; ST s ()
</span><a href="Data.STRef.html#modifySTRef"><span class="hs-identifier hs-var">ST.modifySTRef</span></a></span><span> </span><span class="annot"><span class="annottext">STRef s a
</span><a href="#local-6989586621679566035"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621679566034"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-38"></span><span>
</span><span id="line-39"></span></pre></body></html>